/*
 * File:         cssMinifier.java
 * Author:       Robert Bittle <guywithnose@gmail.com>
 */
package fileHandlers;

import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.StringWriter;

import com.yahoo.platform.yui.compressor.CssCompressor;

/**
 * The Class javaScriptMinifier.
 * 
 * @author Dude
 */
public class CssMinifier
{

  /**
   * Minify.
   *
   * @param fileName the file name
   * @return the string
   */
  public static String minify(String fileName)
  {
    StringWriter out = new StringWriter();
    FileInputStream fis;
    try
    {
      fis = new FileInputStream(fileName);
      InputStreamReader isr = new InputStreamReader(fis);
      CssCompressor cc = new CssCompressor(isr);
      cc.compress(out, -1);
    } catch (IOException e)
    {
      e.printStackTrace();
    }
    return out.toString();
  }
}
